.class Lde/aflx/sardine/impl/SardineImpl$1;
.super Ljava/lang/Object;
.source "SardineImpl.java"

# interfaces
.implements Lorg/apache/http/HttpRequestInterceptor;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lde/aflx/sardine/impl/SardineImpl;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lde/aflx/sardine/impl/SardineImpl;


# direct methods
.method constructor <init>(Lde/aflx/sardine/impl/SardineImpl;)V
    .locals 0

    .line 1
    iput-object p1, p0, Lde/aflx/sardine/impl/SardineImpl$1;->this$0:Lde/aflx/sardine/impl/SardineImpl;

    .line 2
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public process(Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/apache/http/HttpException;,
            Ljava/io/IOException;
        }
    .end annotation

    const-string p1, "http.auth.target-scope"

    .line 1
    invoke-interface {p2, p1}, Lorg/apache/http/protocol/HttpContext;->getAttribute(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lorg/apache/http/auth/AuthState;

    const-string v0, "http.auth.credentials-provider"

    .line 2
    invoke-interface {p2, v0}, Lorg/apache/http/protocol/HttpContext;->getAttribute(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/apache/http/client/CredentialsProvider;

    const-string v1, "http.target_host"

    .line 3
    invoke-interface {p2, v1}, Lorg/apache/http/protocol/HttpContext;->getAttribute(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Lorg/apache/http/HttpHost;

    .line 4
    invoke-virtual {p1}, Lorg/apache/http/auth/AuthState;->getAuthScheme()Lorg/apache/http/auth/AuthScheme;

    move-result-object v1

    if-nez v1, :cond_4

    const/4 v1, 0x0

    .line 5
    new-instance v2, Lorg/apache/http/auth/AuthScope;

    invoke-virtual {p2}, Lorg/apache/http/HttpHost;->getHostName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {p2}, Lorg/apache/http/HttpHost;->getPort()I

    move-result v4

    invoke-direct {v2, v3, v4}, Lorg/apache/http/auth/AuthScope;-><init>(Ljava/lang/String;I)V

    .line 6
    invoke-interface {v0, v2}, Lorg/apache/http/client/CredentialsProvider;->getCredentials(Lorg/apache/http/auth/AuthScope;)Lorg/apache/http/auth/Credentials;

    move-result-object v0

    .line 7
    invoke-virtual {p2}, Lorg/apache/http/HttpHost;->getHostName()Ljava/lang/String;

    move-result-object p2

    .line 8
    sget-object v2, Lde/aflx/sardine/impl/SardineImpl;->authTypes:Ljava/util/HashMap;

    invoke-virtual {v2, p2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/Integer;

    if-eqz v2, :cond_0

    .line 9
    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v1

    :cond_0
    if-eqz v0, :cond_4

    if-nez v1, :cond_1

    .line 10
    new-instance p2, Lorg/apache/http/impl/auth/BasicScheme;

    invoke-direct {p2}, Lorg/apache/http/impl/auth/BasicScheme;-><init>()V

    goto :goto_1

    :cond_1
    const/4 v2, 0x1

    if-ne v1, v2, :cond_3

    .line 11
    new-instance v1, Lorg/apache/http/impl/auth/DigestScheme;

    invoke-direct {v1}, Lorg/apache/http/impl/auth/DigestScheme;-><init>()V

    .line 12
    sget-object v2, Lde/aflx/sardine/impl/SardineImpl;->digest_resp_header:Ljava/util/HashMap;

    invoke-virtual {v2, p2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Lorg/apache/http/Header;

    if-eqz p2, :cond_2

    .line 13
    invoke-interface {v1, p2}, Lorg/apache/http/auth/AuthScheme;->processChallenge(Lorg/apache/http/Header;)V

    goto :goto_0

    :cond_2
    const-string p2, "EEE"

    const-string v2, "resp_auth_head is null"

    .line 14
    invoke-static {p2, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :goto_0
    move-object p2, v1

    goto :goto_1

    .line 15
    :cond_3
    new-instance p2, Lorg/apache/http/impl/auth/NTLMScheme;

    new-instance v1, Lde/aflx/sardine/impl/SardineImpl$JCIFSEngine;

    iget-object v2, p0, Lde/aflx/sardine/impl/SardineImpl$1;->this$0:Lde/aflx/sardine/impl/SardineImpl;

    invoke-direct {v1, v2}, Lde/aflx/sardine/impl/SardineImpl$JCIFSEngine;-><init>(Lde/aflx/sardine/impl/SardineImpl;)V

    invoke-direct {p2, v1}, Lorg/apache/http/impl/auth/NTLMScheme;-><init>(Lorg/apache/http/impl/auth/NTLMEngine;)V

    .line 16
    :goto_1
    invoke-virtual {p1, p2}, Lorg/apache/http/auth/AuthState;->setAuthScheme(Lorg/apache/http/auth/AuthScheme;)V

    .line 17
    invoke-virtual {p1, v0}, Lorg/apache/http/auth/AuthState;->setCredentials(Lorg/apache/http/auth/Credentials;)V

    :cond_4
    return-void
.end method
